package com.mx.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

/**
 * @author mengbin
 * @date 2018年1月18日 下午6:36:41
 */
@Service
public class HelloService {

    @Autowired
    RestTemplate restTemplate;
    
    @HystrixCommand(fallbackMethod="onerror")
    public String find() {
        return restTemplate.getForObject("http://first-service-provider/find", String.class);
    }
    
    public String onerror() {
        return "error occured!!!";
    }
}
